<template>
  <div :class="[`nav-theme-${navTheme}`, `nav-layout-${navLayout}`]">
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider
        v-if="navLayout === 'left'"
        :theme="navTheme"
        :trigger="null"
        v-model="collapsed"
        collapsible
        class="siderBar"
      >
        <div class="logo">
          <img
            src="https://m.smitish.com/wp-content/uploads/2020/08/2020083011341033.png"
            alt="logo"
          />
          在线考试平台
        </div>

        <SiderMenu :theme="navTheme" />
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #fff; padding: 0">
          <a-icon
            :type="collapsed ? 'menu-unfold' : 'menu-fold'"
            @click="collapsed = !collapsed"
            class="trigger"
          ></a-icon>
          <Header />
        </a-layout-header>
        <a-layout-content>
          <router-view></router-view>
        </a-layout-content>
        <a-layout-footer style="text-align: center">
          <Footer />
        </a-layout-footer>
      </a-layout>
    </a-layout>
    <!-- <SettingDrawer /> -->
  </div>
</template>

<script>
import Header from "./Header";
import Footer from "./Footer";
import SiderMenu from "./SiderMenu";
import SettingDrawer from "../components/SettingDrawer/index";

export default {
  computed: {
    navTheme() {
      return this.$route.query.navTheme || "light";
    },
    navLayout() {
      return this.$route.query.navLayout || "left";
    }
  },
  components: {
    Header,
    Footer,
    SiderMenu
    // SettingDrawer
  },
  data() {
    return {
      collapsed: false
    };
  }
};
</script>

<style scoped>
.trigger {
  padding: 0 20px;
  line-height: 64px;
  font-size: 20px;
}
.trigger:hover {
  background: #fff;
}
.logo {
  height: 64px;
  line-height: 64px;
  text-align: center;
  font-weight: 600;
  font-size: 18px;
  overflow: hidden;
}

.nav-theme-dark >>> .logo {
  color: #ffffff;
}
.nav-theme-dark >>> .siderBar {
  color: #ffffff;
  font-size: 18px;
  background-color: #1f1f1f;
}
.nav-theme-light >>> .siderBar {
  font-size: 18px;
}
.nav-theme-light >>> .siderBar {
  font-size: 18px;
  color: #1890ff;
}
.nav-theme-dark >>> .ant-menu-sub {
  background: #141414;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) inset;
}
.ant-layout-sider-children img {
  display: inline-block;
  height: 32px;
  vertical-align: middle;
  transition: height 0.2s;
}
</style>
